﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using System.Windows.Media.Imaging;
using System.Diagnostics;
using DotNetImage.Imaging;

namespace DotNetImageTest
{
    class TestBasicFilters
    {
        [Test]
        [Ignore("Tested and ready")]
        public void TestBrightness()
        {
            DotNetImage.Imaging.DotNetImage img = DotNetImage.Imaging.DotNetImage.FromFile("d:\\rbc.png");

            var timer = System.Diagnostics.Stopwatch.StartNew();

            DotNetImage.Imaging.Filters.BrightnessFilter filter = new DotNetImage.Imaging.Filters.BrightnessFilter();
            filter.Brightness = 128;

            FilterCollection col = FilterCollection.Apply(img, filter);

            TimeSpan ts = timer.Elapsed;

            img.Save("d:\\test_brightness.jpg", SupportedFileFormat.JPEG);
            Debug.WriteLine("***********   BRIGHTNESS TOOK: " + ts.Milliseconds + "ms   ************");
        }


        [Test]
        [Ignore("Tested and ready")]
        public void TestGamma()
        {
            DotNetImage.Imaging.DotNetImage img = DotNetImage.Imaging.DotNetImage.FromFile("d:\\rbc.png");

            var timer = System.Diagnostics.Stopwatch.StartNew();

            DotNetImage.Imaging.Filters.GammaFilter filter = new DotNetImage.Imaging.Filters.GammaFilter();
            filter.Red = 2;
            filter.Green = 2;
            filter.Blue = 2;

            FilterCollection col = FilterCollection.Apply(img, filter);

            TimeSpan ts = timer.Elapsed;

            img.Save("d:\\test_gamma.jpg", SupportedFileFormat.JPEG);
            Debug.WriteLine("***********   GAMMA TOOK: " + ts.Milliseconds + "ms   ************");
        }



        [Test]
        [Ignore("Tested and ready")]
        public void TestGray()
        {
            DotNetImage.Imaging.DotNetImage img = DotNetImage.Imaging.DotNetImage.FromFile("d:\\rbc.png");

            var timer = System.Diagnostics.Stopwatch.StartNew();

            DotNetImage.Imaging.Filters.GrayScaleFilter filter = new DotNetImage.Imaging.Filters.GrayScaleFilter();
            FilterCollection col = FilterCollection.Apply(img, filter);

            TimeSpan ts = timer.Elapsed;
            
            img.Save("d:\\test_gray.jpg", SupportedFileFormat.JPEG);
            Debug.WriteLine("***********   GRAY TOOK: " + ts.Milliseconds + "ms   ************");
        }


        [Test]
        [Ignore("Tested and ready")]
        public void TestSepia()
        {
            DotNetImage.Imaging.DotNetImage img = DotNetImage.Imaging.DotNetImage.FromFile("d:\\abc.png");

            var timer = System.Diagnostics.Stopwatch.StartNew();

            DotNetImage.Imaging.Filters.SepiaFilter filter = new DotNetImage.Imaging.Filters.SepiaFilter();
            FilterCollection col = FilterCollection.Apply(img, filter);

            TimeSpan ts = timer.Elapsed;

            img.Save("d:\\test_sepia.jpg", SupportedFileFormat.JPEG);
            Debug.WriteLine("***********   SEPIA TOOK: " + ts.Milliseconds + "ms   ************");
        }
    }
}
